#include <iostream>
#include <vector>

using namespace std;
class Solution
{
public:
    int commonFactors(int a, int b)
    {
        if (1 == a || 1 == b)
        {
            return 1;
        }

        int ans = 1;
        int s_a = a, s_b = b;
        while (s_b)
        {
            // a,b=a/b,a
            int t = s_b;
            s_b = s_a % s_b;
            s_a = t;
        }
        cout << s_a << endl;
        for (int i = 2; i <= s_a; i++)
        {
            if (a % i == 0 && b % i == 0)
            {
                ans++;
            }
        }
        return ans;
    }
};
int main()
{
    Solution s;
    int a = 452, b = 392;
    cout << s.commonFactors(a, b) << endl;
    return 0;
}
